package chapter13.wrapper.String.StringBuffer.Exercise;

/**
 * @Auther: Tx
 * @Date: 2022/5/9 19:59
 */
public class Ex01 {
    public static void main(String[] args) {
        String s1 = null;
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append(s1);//看append()的源码
        System.out.println(stringBuffer);//null
//抛nullPointerException，因为底层的构造器需要访问s1.length
        StringBuffer stringBuffer1 = new StringBuffer(s1);
        System.out.println(stringBuffer1);

    }
}
